﻿using System;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Net;
using CommDll;
using System.Data.SqlClient;
using System.Drawing;

namespace HospitalMedicineTraceability
{
    /// <summary>
    /// ClassName:frmSetup
    /// Version:1.0
    /// Date:2022-05-23
    /// Author:seanouyang
    /// </summary>
    /// <remarks>
    /// 本类是一WinForm 窗体,本窗体主要为系统参数设置
    /// </remarks>
    public partial class frmSetup : DevComponents.DotNetBar.OfficeForm
    {
        #region 01.自定义属性
        #endregion

        public frmSetup()
        {
            InitializeComponent();
        }

        #region  02.自定义方法
        /// <summary>
        /// 初始化
        /// </summary>
        public void _init()
        {
            //00 初始化
            rbStatusMessageShow1.Checked = AppConfig.m_bIsMessageOK;
            rbStatusMessageShow0.Checked = !rbStatusMessageShow1.Checked;
            rbCollectHint1.Checked = AppConfig.m_bIsCollectHint;
            rbCollectHint0.Checked = !rbCollectHint1.Checked;
            rbCollectSave1.Checked = AppConfig.m_bIsCollectSave;
            rbCollectSave0.Checked = !rbCollectSave1.Checked;

        }
        /// <summary>
        /// 保存数据
        /// </summary>
        public void _saveInfo()
        {
            AppConfig.m_bIsMessageOK = rbStatusMessageShow1.Checked;
            AppConfig.m_bIsCollectHint = rbCollectHint1.Checked;
            AppConfig.m_bIsCollectSave = rbCollectSave1.Checked;
            AppConfig.m_iniSetup._writeValue("Common", "IsMessageOK", AppConfig.m_bIsMessageOK?"1":"0");
            AppConfig.m_iniSetup._writeValue("Common", "IsCollectHint", AppConfig.m_bIsCollectHint ? "1" : "0");
            AppConfig.m_iniSetup._writeValue("Common", "IsCollectSave", AppConfig.m_bIsCollectSave ? "1" : "0");
   
            DialogResult = DialogResult.OK;
        }

        #endregion

        #region 03.系统事件方法
        private void frmSetup_Load(object sender, EventArgs e)
        {
            //01 初始化显示
            _init();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            _saveInfo();
        }

        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #endregion
    }
}
